import numpy as np
import matplotlib.pyplot as plt

"""
3 ---- 2 ---> 6
target value is 10
prediction value is 6
loss function is MSE
"""
weight = 0
x = 3
target = 10

loss_value = (weight - target) ** 2
weights = []
losses = []
tmp_weight = 0
for i in range(0, 40):
    weights.append(tmp_weight)
    tmp_weight = tmp_weight + 0.01 * i
    tmp_loss_value = (tmp_weight - target) ** 2
    losses.append(tmp_loss_value)

plt.figure(figsize=(10, 6))
plt.plot(weights, losses, '-o', markersize=5)
plt.title('Mean Squared Error Loss vs. Weight')
plt.xlabel('Weight')
plt.ylabel('Mean Squared Error Loss')
plt.grid(True)
plt.show()
